import { connect } from "react-redux"
/**
 * 使用redux,react-redux,thunk 使用的方法
 * @param {*} state 
 * @returns 
 */

const mapStateToProps = state => {
  // state.auth  命名空间中 是以combineReducers  传入的对象的键值为区分的
  return {
    articles: state.auth.articles,
  }
}

const mapDispatchToProps = dispatch => {
  return {
    saveArticle: article => dispatch(article),
  }
}
function App({ articles, saveArticle }) {

  return (
    <div className="App">
       {articles.map(article => (
         <div key={article.id} article={article} >  { article.title } </div>
      ))}
    </div>
  );
}

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(App)
// export default App;
